<!DOCTYPE html>
<extend name="Base/base" />
<block name='head'>  
    <meta charset="utf-8">
    <link href="/Public/Index/css/workflow.css" rel="stylesheet" /> 
    <style type="text/css">
        .t4{color:#bbb}
        .trip_title h2 {
            font-size:1.3em;
            margin:1.2em;
            color:#5077aa;
        }
        .trip_next h3{
            font-size:1em;
            padding:0.8em;
        }
        .trip_next table{
            width:100%;
        }
        .trip_next table tr td{
            border:1px solid #CFDDEA;
            font-size:1.2em;
            padding:0.3em 0;
            text-align: center;
        }
        .trip_next table .value{
            width:80%;
            text-align: left;
            padding-left:10px;
        }
        .trip_next table .value .addUser,.addDept{color:#437dba}
        .trip_next table .key{
            width:17%;
            text-align: center;
            background: #F0F0F0;
        }
        .trip_next table .value .textarea{
            display:inline-block;
            border:1px solid #333;
            height:4em;
        }
        .trip_next table .value .textarea span{margin-right:0.5em}
        .trip_next table .value input,.textarea,select,textarea{
            width:55%;
            padding:0.3em;
        }

        .trip_next table .value .date{
            width:30%
        }

        .button .btn-submit{
            padding:0.3em 2em;
            font-size: 1.2em;
        }
        .button span{display:inline-block;margin-left:20%}

    </style>
</block>
<block name="content" > 
    <form name='form1'>
        <div class="bd">
            <div class="trip_title">
                <h2>{$id?'编辑周报':'新建周报'}</h2>
            </div>
            <div class="work_cells trip_next">
                <table>
                    <tr>
                        <td class="key">标题</td>
                        <td class="value">
                            <input type="text" name="title" value="<if condition='$info[title] neq null'>{$info.title}<else/>本周总结</if>">
                        </td>
                    </tr>
                    <tr>
                        <td class="key">日期</td>
                        <td class="value">
                            <input type="text" class="datepickerInput" name="start_date" value="<if condition='$info[start_date] neq 0'>{$info.start_date|date='Y-m-d',###}</if>"/>至
                            <input type="text" class="datepickerInput" name="end_date" value="<if condition='$info[end_date] neq 0'>{$info.end_date|date='Y-m-d',###}</if>"/>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">内容</td>
                        <td class="value">
                            <textarea name="content" style="width:80%;height:20em;">{$info.content}</textarea>
                        </td>
                    </tr> 
                    <tr>
                        <td class="TableHeader" colspan="2">
                            <div class="share" title="点击展开/收缩选项" onClick="share();" style="cursor:pointer;width:125px;">
                                <img class="arrow" src="/Public/Index/img/right.png" align="absMiddle"> 指定共享部门
                            </div>
                        </td>
                    </tr>      
                    <tr id="share" <if condition="$info[to_id] eq null">style="display:none"</if>>
                        <td nowrap class="TableData">共享范围：</td>
                        <td class="TableData value">
                            <p class="textarea depart" style="border:1px solid #929292">
                                <span></span>
                        <foreach name="depts" item="dept">
                            <span>
                                <a>{$dept|getDeptName}</a>
                                <img class="pointer delOperator" data-id="{$dept}" src="/Public/Index/img/close_red.png" alt="close" width="15"/>
                                <input type="hidden" name="dept_ids[]" value="{$dept}"/>
                                <input type="hidden" name="dept_names[]" value="{$dept|getDeptName}"/>
                            </span>
                        </foreach>
                            </p>
                            
                            <a class="pointer addDept" data-id="1">+添加 </a>
                            <a class="pointer delData">-清空</a>
                            <a href="#" class="orgAdd" onClick="document.getElementById('TO_NAME').value = document.getElementById('Share_Name').value;document.getElementById('TO_ID').value = document.getElementById('Share_ID').value;"> </a>

                        </td>
                    </tr>
                </table>
            </div>
            <div class="button">
                <span>
                    <input type="hidden" name="id" value="{$info.id}">
                    <a class="pointer btn-submit ajax-post" data-verify="all" data-url="{:U('saveWeekly')}" data-form="">提交</a>
                    <!--<a class="pointer btn-submit ajax-post" data-verify="all" data-url="{:U('addDiary',array('DIA_TYPE'=>1))}" data-form="">保存</a>-->
                </span>
            </div>
        </div>
    </form>
    <div class="button">
        <a class="am-btn" onclick="history.go(-1)">返 回</a>
    </div>

</block>
<block name="script">
    <script type="text/javascript" src="/Public/Index/js/diary.js"></script>
    <script type="text/javascript">
            $(dateTime(0));
            $(initAddDiary());
            function share() {
                var obj = document.getElementById("share");
                if (obj.style.display == 'none') {
                    obj.style.display = '';
                    $('.arrow').attr('src', '/public/Index/img/down2.png');
                } else {
                    obj.style.display = 'none';
                    $('.arrow').attr('src', '/Public/Index/img/right.png');
                }
            }
    </script>
</block>
